﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;



namespace DKE_Kinect.Entwicklung.Core
{
    /// <summary>
    /// Gibt Informationen über den aktuellen Status an
    /// </summary>
    public class StatusInfo
    {
        /// <summary>
        /// Textur mit den Pictogrammen
        /// </summary>
        static Texture2D pics;
        /// <summary>
        /// Zielrechteck Oben Links
        /// </summary>
        static Rectangle pDestRect1 = new Rectangle(0, 0, 50, 50);
        /// <summary>
        /// Zielrechteckt Oben Links, unter dem 1.
        /// </summary>
        static Rectangle pDestRect2 = new Rectangle(0, 50, 50, 50);
        static Rectangle pSourceRect1 = new Rectangle(0, 300, 50, 50);
        static Rectangle pSourceRect2 = new Rectangle(50, 150, 50, 50);
        /// <summary>
        /// Inits this instance.
        /// </summary>
        private static void init()
        {
            pics = ContentManager.loadContent<Texture2D>("textures/pic_info");
        }

        /// <summary>
        /// Draws the status.
        /// </summary>
        /// <param name="batch">Spritebatch der verwendet wird</param>
        public static void DrawStatus(SpriteBatch batch)
        {
            try
            {
                batch.Draw(pics, pDestRect1, pSourceRect1, Color.White);
                batch.Draw(pics, pDestRect2, pSourceRect2, Color.White);
            }
            catch (ArgumentNullException e)
            {
                Console.WriteLine(e.Message);
                StatusInfo.init();
            }
        }
        /// <summary>
        /// Sets the kinect data status to unknown
        /// </summary>
         public static void SetKinectDataStatus()
         {
               pSourceRect2.Y = 150;
         }

         /// <summary>
         /// Sets the kinect data status.
         /// </summary>
         /// <param name="_status">The _status.</param>
        public static void SetKinectDataStatus(eKinectStatus _status)
        {
            switch (_status)
            {
                case (eKinectStatus.connected):
                    {
                        pSourceRect2.Y = 0;
                        break;
                    }
                case (eKinectStatus.disconnected):
                    {
                        pSourceRect2.Y = 100;
                        break;
                    }
                case (eKinectStatus.playback):
                    {
                        pSourceRect2.Y = 50;
                        break;
                    }
            }
        }
        /// <summary>
        /// Sets the modus status to unknown
        /// </summary>
        public static void SetModusStatus()
        {
            pSourceRect1.Y = 300;
        }
        /// <summary>
        /// Sets the modus status.
        /// </summary>
        /// <param name="_status">The _status.</param>
        public static void SetModusStatus(eModus _status)
        {
            switch (_status)
            {
                case (eModus.calibration):
                    {
                        pSourceRect1.Y = 0;
                        break;
                    }
                case (eModus.painting):
                    {
                        pSourceRect1.Y = 50;
                        break;
                    }
                case (eModus.moving):
                    {
                        pSourceRect1.Y = 100;
                        break;
                    }
                case (eModus.eraser):
                    {
                        pSourceRect1.Y = 150;
                        break;
                    }
                case (eModus.cameraModeOrbital):
                    {
                        pSourceRect1.Y = 200;
                        break;
                    }
                case (eModus.cameraModeLook):
                    {
                        pSourceRect1.Y = 250;
                        break;
                    }

            }
        }
    }

}
